import { source } from '../services/component';
import { lists } from '../services/democraticappraisal'

export default {
  namespace: 'review',
  state: {
  },

  subscriptions: {
    setup({ dispatch, history }) {
      history.listen(({pathname, query}) => {
        if (pathname.toString() == "/work/dysupportxx") {
          dispatch({type: 'audit'});
        }
      })
    }
  },

  effects: {
    //帮扶列表
    *audit({payload}, { call, put, select }) {
      // const userdata = sessionStorage.getItem("userdata");
      // const c = JSON.parse(userdata)
      // console.log(c.data.ret.administrator.org_code,"userdata1111111111111111111111111111")
      const {data} = yield call(lists, {relation:["org"]});
      yield put({
        type: 'success',
        payload: {
          data1:data
        }
      })
    }
  },

  reducers: {
    success(state, action){
      return {...state, ...action.payload};
    }
  }
};
